﻿using University.Workshop.Model;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using University.Workshop.DataAccess;
using System.Net.Sockets;
using System.Net;

namespace University.Workshop.Tests
{
    
    
    /// <summary>
    ///This is a test class for ClientManagerTest and is intended
    ///to contain all ClientManagerTest Unit Tests
    ///</summary>
    [TestClass()]
    public class ClientManagerTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for SendBytes
        ///</summary>
        [TestMethod()]
        public void SendBytesTest()
        {
            ClientManager target = new ClientManager(); // TODO: Initialize to an appropriate value
            byte[] message = null; // TODO: Initialize to an appropriate value
            target.SendBytes(message);
            
        }

        /// <summary>
        ///A test for JoinToTheTable
        ///</summary>
        [TestMethod()]
        public void JoinToTheTableTest()
        {
            ClientManager target = new ClientManager(); // TODO: Initialize to an appropriate value
            string name = "Roberto"; // TODO: Initialize to an appropriate value
            bool expected = true; // TODO: Initialize to an appropriate value
            bool actual;
            actual = target.JoinToTheTable(name,"800",1,0,"5");
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for UserToByteArray
        ///</summary>
        [TestMethod()]
        [DeploymentItem("University.Workshop.Model.dll")]
        public void UserToByteArrayTest()
        {
            ClientManager_Accessor target = new ClientManager_Accessor(); // TODO: Initialize to an appropriate value
            User user = new User();
            user.Name="Luchito";
            object userReceived =user ; // TODO: Initialize to an appropriate value
            byte[] expected = null; // TODO: Initialize to an appropriate value
            byte[] actual;
            actual = target.UserToByteArray(userReceived);
            Assert.AreNotEqual(expected, actual);
        }

        /// <summary>
        ///A test for Bet
        ///</summary>
        //[TestMethod()]
        //[DeploymentItem("University.Workshop.Model.dll")]
        //public void BetTest()
        //{
        //    ClientManager_Accessor target = new ClientManager_Accessor(); // TODO: Initialize to an appropriate value
        //    string[] words = {"0","0","0"}; // TODO: Initialize to an appropriate value
        //    target.Bet(words);            
        //}

        /// <summary>
        ///A test for SendTheHand
        ///</summary>
        [TestMethod()]
        [DeploymentItem("University.Workshop.Model.dll")]
        public void SendTheHandTest()
        {
            ClientManager_Accessor target = new ClientManager_Accessor(); // TODO: Initialize to an appropriate value
            target.SendTheHand();
        }

        /// <summary>
        ///A test for SetNewBet
        ///</summary>
        [TestMethod()]
        [DeploymentItem("University.Workshop.Model.dll")]
        public void SetNewBetTest()
        {
            ClientManager_Accessor target = new ClientManager_Accessor(); // TODO: Initialize to an appropriate value
            target.SetNewBet();
        }

        /// <summary>
        ///A test for TheLastBet
        ///</summary>
        [TestMethod()]
        public void TheLastBetTest()
        {
            ClientManager target = new ClientManager(); // TODO: Initialize to an appropriate value
            bool expected = true; // TODO: Initialize to an appropriate value
            bool actual;
            actual = target.TheLastBet();
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for VeryfyTurn
        ///</summary>
        [TestMethod()]
        [DeploymentItem("University.Workshop.Model.dll")]
        public void VeryfyTurnTest()
        {
            ClientManager_Accessor target = new ClientManager_Accessor(); // TODO: Initialize to an appropriate value
            bool expected = false; // TODO: Initialize to an appropriate value
            bool actual;
            actual = target.VeryfyTurn();
            Assert.AreEqual(expected, actual);            
        }

        /// <summary>
        ///A test for resetAll
        ///</summary>
        [TestMethod()]
        [DeploymentItem("University.Workshop.Model.dll")]
        public void resetAllTest()
        {
            ClientManager_Accessor target = new ClientManager_Accessor(); // TODO: Initialize to an appropriate value
            target.resetAll();            
        }

        /// <summary>
        ///A test for AdviceAll
        ///</summary>
       /* [TestMethod()]
        [DeploymentItem("University.Workshop.Model.dll")]
        public void AdviceAllTest()
        {
            IPAddress ip = IPAddress.Parse("127.0.0.1");
            Socket skt = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            IPEndPoint ep = new IPEndPoint(ip, 2999);
            skt.Connect(ep);
            NetworkStream ns = new NetworkStream(skt, true);
            string message = "Message";             
            TableManager.Instance.AllGames.Add(ns);
            ClientManager_Accessor.NotifyAll(message);            
        }
        */
    }
}
